<include file="Public:header" />

<div id="page-body">
    <div id="qan-breadcrumbs">
    	<span><a href="{$_global.site_url}">{$Think.lang.home}</a></span>&gt;&nbsp;
    	<span>{$Think.lang.user_activity}</span>
    	<eq name="user.user_id" value="$_user.user_id">
        <span>&gt;&nbsp;<a href="{:U('User/setting',array('uid'=>$user['user_id']))}">{$Think.lang.user_settings}</a></span>
        </eq>
    </div>
    <div id="qan-content">
        <div id="user-container" class="container">
            <div id="user-profile">
                <div id="info">
                    <eq name="user.user_id" value="$_user.user_id">
                    <a href="http://en.gravatar.com/" title="{$Think.lang.user_change_avatar}"><img class="avatar" src="{$user.email|get_avatar=###,96}" /></a>
                    <else/>
                    <img class="avatar" src="{$user.email|get_avatar=###,96}" />
                    </eq>
                    <p class="percent"><span class="best-answer">{$user.best_answer_count|get_percentage=$user['answer_count']}%</span>{$Think.lang.best_answer}</p>
                </div>
                <div id="summary">
                    <h1>
                        {$user.username}
                        <eq name="user.require_confirm" value="1">
                        <span><a href="{:U('User/confirmAccount',array('uid'=>$user['user_id']))}" title="{$Think.lang.user_resend_confirm_email}">{$Think.lang.user_account_inactive}</a></span>
                        </eq>
                    </h1>
                    <ul class="meta">
                        <li>{$Think.lang.user_since}: {$user.register_date}</li>
                        <neq name="user.user_id" value="$_user.user_id">
                        <li>
                            <span><a href="javascript:void(0)" onclick="pmDialog('{$user.user_id}')">{$Think.lang.pm}</a></span>
                            <switch name="user.follow_status">
                            <case value="-1">
                            <span><a href="{:U('User/follow',array('uid'=>$user['user_id'],'type'=>'unblock'))}">{$Think.lang.user_follow_unblock}</a></span>
                            </case>
                            <case value="0">
                            <span><a href="{:U('User/follow',array('uid'=>$user['user_id'],'type'=>'add'))}">{$Think.lang.user_follow}</a></span>
                            <span><a href="{:U('User/follow',array('uid'=>$user['user_id'],'type'=>'block'))}">{$Think.lang.user_follow_block}</a></span>
                            </case>
                            <case value="1">
                            <span><a href="{:U('User/follow',array('uid'=>$user['user_id'],'type'=>'remove'))}">{$Think.lang.user_follow_remove}</a></span>
                            </case>
                            </switch>
                        </li>
                        </neq>
                        <li>
                            <span>{$Think.lang.user_following}: (<a id="following-count" href="{:U('User/network',array('uid'=>$user['user_id'],'type'=>'following'))}">{$user.following_count}</a>)</span>
                            <span>{$Think.lang.user_followers}: (<a id="follower-count" href="{:U('User/network',array('uid'=>$user['user_id'],'type'=>'follower'))}">{$user.follower_count}</a>)</span>
                        </li>
                        <notempty name="user.website">
                        <li>{$Think.lang.user_website}: <a href="{$user.website}">{$user.website}</a></li>
                        </notempty>
                        <notempty name="user.location">
                        <li>{$Think.lang.user_location}: {$user.location}</li>
                        </notempty>
                    </ul>
                </div>
            </div>
            <div id="user-point-level">
                <ul>
                    <li class="current">{$user.group_name}</li>
                    <li>{$Think.lang.user_points|sprintf=$user['point_count']}</li>
                    <eq name="user.admin_group" value="0">
                    <li>{$Think.lang.user_upgrade_points|sprintf=$user['upgrade_points']}</li>
                    </eq>
                    <li>{$Think.lang.user_week_points|sprintf=$user['week_points']}</li>
                </ul>
                <notempty name="user.medals">
                <div class="medals">
                    <volist name="user.medals" id="vo">
                    <img src="__PUBLIC__/Images/Medals/{$vo.image}" title="{$vo.description}" alt="{$vo.description}" />
                    </volist>
                </div>
                </notempty>
            </div>
            <div id="user-about">
                <h2 onclick="aboutToggle(this)">{$Think.lang.user_about}<span class="expand">expand</span></h2>
                <div class="content"><empty name="user.about">{$Think.lang.user_about_default}<else/>{$user.about|parse_markup}</empty></div>
            </div>
        </div>

        <!-- user qa -->
        <div id="user-qa-container">
            <ul id="qa-nav" class="tabs">
                <li class="current"><a href="{:U('User/qa',array('uid'=>$user['user_id'],'type'=>'answered'))}">{$Think.lang.user_answers}</a></li>
                <li><a href="{:U('User/qa',array('uid'=>$user['user_id'],'type'=>'team-answered'))}">{$Think.lang.user_team_answers}</a></li>
                <li><a href="{:U('User/qa',array('uid'=>$user['user_id'],'type'=>'asked'))}">{$Think.lang.user_questions}</a></li>
                <li><a href="{:U('User/qa',array('uid'=>$user['user_id'],'type'=>'starred'))}">{$Think.lang.user_starred_questions}</a></li>
                <eq name="user.user_id" value="$_user['user_id']">
                <li><a href="{:U('User/qa',array('uid'=>$user['user_id'],'type'=>'followed'))}">{$Think.lang.user_followed_questions}</a></li>
                </eq>
            </ul>
            <if condition="$user['perms']['share_qa_activity']">
                <notempty name="questions">
                <ul class="questions">
                    <volist name="questions" id="vo" mod="2">
                    <li class="item <eq name="mod" value="0">alt</eq>">
                        <div class="avatar"><a href="{$vo.user_id|format_user_url=$vo['username']}"><img src="{$vo.email|get_avatar}" alt="{$vo.username}" /></a></div>
                        <div class="info">
                            <h3><a href="{$vo.question_id|format_question_url=$vo['title']}">{$vo.title}</a> - <span class="status">{$vo.status|get_question_status}</span></h3>
                            <ul class="meta">
                                <li class="stars"><a href="#nogo"><span class="star-count has-stars">{$vo.star_count}</span><span class="star">Stars</span></a></li>
                                <li>{$Think.lang.asked_by} <a href="{$vo.user_id|format_user_url=$vo['username']}">{$vo.username}</a> - </li>
                                <li>{$Think.lang.in} <a href="{$vo.category_id|format_category_url}">{$vo.category_id|get_category_name}</a> - </li>
                                <li>{$vo.answer_count} {$Think.lang.answer_count} - </li>
                                <li><abbr title="{$vo.create_time|format_date}">{$vo.create_time|pretty_date}</abbr></li>
                            </ul>
                        </div>
                    </li>
                    </volist>
                    <li class="more"><a class="btn" href="{:U('User/qa',array('uid'=>$user['user_id'],'type'=>'answered'))}">{$Think.lang.user_more_answers}</a></li>
                </ul>
                <else/>
                <p class="no-results">{$Think.lang.user_no_results}</p>
                </notempty>
            <else/>
            <p class="tips">{$Think.lang.user_private_activity}</p>
            </if>
        </div>

        <!-- member activities -->
        <div id="user-activities">

        </div>
    </div>

    <div id="qan-sidebar">
        <include file="User:sidebar" />
    </div>
</div>

<script type="text/javascript">
function aboutToggle(obj){
    var flag = $(obj).find('span');
    $('#user-about>.content').toggle();
    if(flag.attr('class') == 'expand'){
        flag.attr('class','collapse');
    }else{
        flag.attr('class','expand');
    }
}
</script>

<include file="Public:footer" />
